package exercise;

import java.util.Objects;
class Money implements  Cloneable{
    public double  money =9.9;
    @Override
    protected  Object clone()
        throws CloneNotSupportedException{
            return super.clone();
        }

    }
public class Person implements Cloneable {
    public String name;
    public int age;
    public Money m = new Money();

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
    protected  Object clone() throws CloneNotSupportedException {
            Person tmp =(Person)super.clone();
            tmp.m =(Money) this.m.clone();
            return tmp;
        }
    }
